HTMLify
app.js
Views: 9 | Author: huxn-webdev
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | const clock = document.querySelector(".clock"); clock.addEventListener("load", tick); function tick() { const now = new Date(); const h = now.getHours(); const m = now.getMinutes(); const s = now.getSeconds(); const html = ` <span>${h} :</span> <span>${m} :</span> <span>${s}</span> `; clock.innerHTML = html; } setInterval(tick, 1000); |